﻿/*
*┌─────────────────────────────────┐
*│　描   述：当点击提现的时候
*│　类   名：OnClickWithDrew.cs 
*│　创  建  人：DD
*│　创建时间：9.8
*│　Copyright(C) 2020 by DD
*└─────────────────────────────────┘
*┌─────────────────────────────────┐
*│　修  改  人：
*│　创建日期：
*└─────────────────────────────────┘
*/
using UnityEngine;
using UnityEngine.UI;

namespace DD
{
    public class OnClickWithDrew : MonoBehaviour
    {

        public Text text;

        public void OnClickWithDrewOrCloseBtn(float time)
        {
            Event.Instance.Track ( "Tap_CashOut" );
            Time.timeScale = time;

        }

        private void Update( )
        {
            if ( text )
            {
                text.text = "$" + PlayerPrefs.GetFloat ( "Money" ).ToString ( "#0.00" );
            }
        }



        public void OnClickAmazonOrPayPal( )
        {
            Transform tipsParent = GameObject.Find ( "TipsParent" ).transform;
            GameObject go =Resources.Load<GameObject> ( "Prefabs/Tips" );

            if ( tipsParent != null && tipsParent.transform.childCount < 1 )
            {
                if ( go != null )
                {
                    GameObject gos=Instantiate(go,tipsParent  , false );
                    Destroy ( gos , 0.5f);
                    if ( PlayerPrefs.GetFloat ( "Money" ) < 100 )
                    {
                        gos.GetComponentInChildren<Text> ().text = "Money’s not enough!";
                    }
                    else
                    {
                        gos.GetComponentInChildren<Text> ().text = "Network busy now, try again later!";
                    }
                }
            }

        }
    }
}